package mint.modules.symbol;

import java.util.Formatter;

import mint.modules.generator.VariableDeclarationNode;
import mint.modules.type.Type;

public class VariableSymbol extends Symbol {
	private Type type;
	private int number;
	private VariableDeclarationNode node;
	
	public VariableSymbol(VariableDeclarationNode node, int varNumber) {
		super(node.getName());
		type = node.getType();
		number = varNumber;
		this.node = node;
	}
	
	public Type getType()
	{
		return type;
	}
	
	public int getNumber()
	{
		return number;
	}
	
	public boolean isEnabled()
	{
		return node.isEnabled();
	}
	
	@Override
	public SymbolType getSymbolType() {
		return SymbolType.Variable;
	}
	
	@Override
	public void print(Formatter output, int tabSize) {
		for (int i = 1; i <= tabSize; i++)
			output.format("\t");
		
		output.format("%s : ", getName());
		type.print(output);
		output.format("\n");
	}
}